package com.four.util;

import java.util.HashMap;
import java.util.Map;

public class ResponseMessage {
    private String code;
    private String message;
    private Map<String,Object> objectMap=new HashMap<>();

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Map<String, Object> getObjectMap() {
        return objectMap;
    }

    public void setObjectMap(Map<String, Object> objectMap) {
        this.objectMap = objectMap;
    }
    public ResponseMessage addObject(String key,Object value){
        this.objectMap.put(key,value);
        return this;
    }
    public static ResponseMessage success(){
        ResponseMessage responseMessage = new ResponseMessage();
        responseMessage.setCode("200");
        responseMessage.setMessage("处理成功");
        return responseMessage;
    }
    public static ResponseMessage error(){
        ResponseMessage responseMessage = new ResponseMessage();
        responseMessage.setCode("500");
        responseMessage.setMessage("处理处理失败");
        return responseMessage;
    }
}
